import {
  createRouter,
  createWebHistory,
  RouteRecordRaw,
  Router,
} from 'vue-router';
import { staticRoutes } from './routes';
import {
  routeForwardGuardCallBack,
  routeBackGuardCallBack,
} from './routeGuard';

const router: Router = createRouter({
  history: createWebHistory(),
  routes: staticRoutes as RouteRecordRaw[],
  scrollBehavior() {
    return {
      left: 0,
      top: 0,
    };
  },
});

router.beforeEach(routeForwardGuardCallBack);
router.afterEach(routeBackGuardCallBack);

export default router;
